﻿#include "commonpage.h"
#include "ui_commonpage.h"
#include "listitembox.h"

CommonPage::CommonPage(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::CommonPage)
{
    ui->setupUi(this);
}

CommonPage::~CommonPage()
{
    delete ui;
}

void CommonPage::setCommonPageUI(const QString& text, const QString& imagePath) {
    ui->pageTitle->setText(text);

    ui->musicImageLabel->setPixmap(imagePath);
    ui->musicImageLabel->setScaledContents(true);

    ListItemBox* listItemBox = new ListItemBox(this);
    QListWidgetItem* item = new QListWidgetItem(ui->pageMusicList);
    item->setSizeHint(QSize(listItemBox->width(), listItemBox->height()));
    ui->pageMusicList->setItemWidget(item, listItemBox);
}
